---
sidebar_position: 10
title: Graphics
---

# Graphics

The `@devicescript/graphics` package provides an `Image` type and a `Display` type that supports
paletted graphics.

![Progress bar image](../jsx.png)

The [image](/developer/graphics/image) can be used to author efficient driver for small screens
such as the [SSD1306 OLED screen](/api/drivers/ssd1306)

```ts
import { Image } from "@devicescript/graphics"

const img = Image.alloc(128, 64, 1)
```

-   [Image](/developer/graphics/image)

A [display](/developer/graphics/display) driver for a screen, such as the [SSD1306](/api/drivers/ssd1306),
exposes an image that represents the screen buffer. The driver typically
can be used as an indexed screen service which provides simulation support.

```ts
import { SSD1306Driver, startIndexedScreen } from "@devicescript/drivers"

const screen = await startIndexedScreen(
    new SSD1306Driver({ width: 128, height: 64, devAddr: 0x3c })
)
screen.image.print(`Hello world!`, 3, 10)
await screen.show()
```

-   [Display](/developer/graphics/display)
